package com.china.springServer.desigen.factory.factory_method;

public class Client {

    public static void main(String[] args) {

        // 传入具体产品的咖啡工厂
        CoffeeStore store = new CoffeeStore(new LatteCoffeeFactory());
        Coffee coffee = store.orderCoffee();
        System.out.println(coffee.getName());
        // 实现对扩展开发，对修改关闭，当新增咖啡类型时，仅需要新增咖啡工厂
        store.setCoffeeFactory(new AmericanCoffeeFactory());
        coffee = store.orderCoffee();
        System.out.println(coffee.getName());
    }

}
